package com.big.tree.service.singleton;


/**
 * 内部类模式 - 懒汉式的优化版
 * @author big tree
 */
public class InnerClassSingleton {

    private InnerClassSingleton(){}

    public static InnerClassSingleton getInstance(){
        return InnerSingleton.obj;
    }

    private static class InnerSingleton{
        // 不注释的话可以通过反射获取和修改obj属性
        private InnerSingleton(){}

        private static final InnerClassSingleton obj = new InnerClassSingleton();
    }

}
